package com.guodidi.media.domain.bo;

import lombok.Data;

import java.nio.file.Path;

/**
 * Created by 郭垚辉 on 2017/7/28.
 */

@Data
public class CustomFile {

    //
    private Path path;

    private String fileName;

    private String extName;

    public CustomFile(Path path) {
        this.path = path;
        String fileNameWithExtName = path.getFileName().toString();
        int index = fileNameWithExtName.lastIndexOf(".");
        this.fileName = fileNameWithExtName.substring(0, index);
        this.extName = fileNameWithExtName.substring(index);
    }

    public static CustomFile getFile(Path path) {
        return new CustomFile(path);
    }


}
